package com.yzy.controller;

import com.yzy.dao.DoctorDao;
import com.yzy.entity.Doctors;

import java.io.IOException;
import java.io.PrintWriter;

public class DoctorAddServlet extends javax.servlet.http.HttpServlet {


    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {


        String doctorname = request.getParameter("doctorname");
        String doctorage = request.getParameter("doctorage");
        String doctorexperience = request.getParameter("doctorexperience");
        String doctorpass = request.getParameter("doctorpass");
        String doctorsex = request.getParameter("doctorsex");
        DoctorDao dao=new DoctorDao();
        Doctors doctor = null;
        int result=0;
        PrintWriter out = null;
        //2
        doctor = new Doctors(null,doctorname,doctorage,doctorexperience,doctorpass,doctorsex);
        result=dao.add(doctor);
        //3
        response.setContentType("text/html;charset=utf-8");
        out=response.getWriter();
        if(result == 1){
            out.print("<font style='color:red;font-size:40'>医生信息注册成功</font>");
        }else{
            out.print("<font style='color:red;font-size:40'>医生信息注册失败</font>");
        }

    }
}
